Skip to content

allow override cpu and ram#1241

Closed
giurgiur99 wants to merge 1 commit intomainfrom
override-cpu-ram
Closed

allow override cpu and ram#1241
giurgiur99 wants to merge 1 commit intomainfrom
override-cpu-ram

Conversation

@giurgiur99
Copy link
Contributor

Fixes # .

Changes proposed in this PR:

@alexcos20
Copy link
Member

/run-security-scan

@giurgiur99 giurgiur99 marked this pull request as ready for review March 2, 2026 12:14
Copy link
Member

@alexcos20 alexcos20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI automated code review (Gemini 3).

Overall risk: low

Summary:
This pull request enhances the C2D engine's resource management by allowing CPU and RAM resource configurations (total, max, min) to be overridden via envConfig.resources. Previously, only non-CPU/RAM resources could be added or configured this way. The changes enable more granular control over compute resources per environment, aligning with the intent to allow custom overrides for core resources.

Comments:
• [INFO][other] The logic else if (res.total != null) existing.max = res.total effectively sets existing.max to existing.total if res.max is not explicitly provided but res.total is. This ensures max is always updated to at least total when total is present. This seems to be a deliberate design choice to infer max from total.
• [INFO][other] If res.id is 'cpu' or 'ram' but existing is undefined (i.e., 'cpu' or 'ram' is not found in this.envs[0].resources), the current logic silently skips the update. This is likely acceptable given that CPU and RAM are expected to be default resources always present. However, if there's a scenario where they might not be, this would prevent configuration. Consider if an else branch to add the resource if existing is not found, or a warning/error, would be beneficial, though probably not required for the current design.

@giurgiur99
Copy link
Contributor Author

Equivalent to #1242

@giurgiur99 giurgiur99 closed this Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants